package com.macro.mall.portal.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.macro.mall.portal.dao.TaxationMapper;
import com.macro.mall.portal.domain.ConsultFiles;
import com.macro.mall.portal.domain.Taxation;
import com.macro.mall.portal.service.ITransferService;
import com.macro.mall.portal.dao.TransferMapper;
import com.macro.mall.portal.domain.Transfer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 查档表、过户价表 服务实现类
 * </p>
 *
 * @author db
 * @since 2021-07-04
 */
@Service
public class TransferServiceImpl extends ServiceImpl<TransferMapper, Transfer> implements ITransferService {


    @Autowired
    private TransferMapper transferMapper;

    @Override
    public void addOne(Transfer transfer) {
        //todo 验证码
        // if(!verifyAuthCode(authCode,telephone)){
        //   Asserts.fail("验证码错误");
        // }
        transferMapper.insert(transfer);
    }

    @Override
    public IPage<Transfer> selectBy(String openid, Integer page, Integer size) {
        QueryWrapper<Transfer> wrapper = new QueryWrapper<>();
        wrapper.eq("open_id", openid);
        wrapper.orderByDesc("create_time");
        Page<Transfer> userPage = new Page<>(page, size);
        IPage<Transfer> transferIPage = transferMapper.selectPage(userPage, wrapper);
        return transferIPage;
    }
}
